# Libreries
IFLAGS=-I../lib -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
LDFLAGS=-ldbus-1

# Options
EXTRA="-O"
EXTENSION=.x86
COMPILER=g++

# Source files
SOURCES:=$(wildcard *.c)
# Source or compiling files
OBJECTS=$(SOURCES:.c=.o)

all: clean build

build:
	@ echo "## Building tests $(EXTENSION) ..."
	@ for i in $(SOURCES);do \
		$(COMPILER) $(EXTRA) $(IFLAGS) -c $$i	-o `echo $$i | cut -d . -f 1`.o;\
	done
	@ echo "## Compiling tests $(EXTENSION) ..."
	@ for i in $(OBJECTS);do \
		$(COMPILER) $(EXTRA) $(LDFLAGS) $$i \
		-o `echo $$i | awk -F/ '{print $$NF}' | cut -d . -f 1`.exec;\
	done

clean:
	@ echo "## Cleaning tests ..."
	@	$(RM) *.o;
	@ $(RM) *.exec;

